function getInstance(): CC | undefined {
  return new CC();
}

const instance = getInstance();
console.info(`${instance?.bar}`);
instance?.foo();

class CC {
  public bar = 'hello';

  public foo(): void {
    console.info('foo');
  }
}

foo?.bar;
foo?.bar();

// github
foo.bar!;
foo.bar!.baz;
foo.bar!.baz();
foo.bar()!;
foo.bar()!();
foo.bar()!.baz;
foo?.bar;
foo?.bar();
(foo?.bar).baz!;
(foo?.bar()).baz!;
foo?.bar!.baz;
foo?.bar!();
foo?.['bar']!.baz;